using Microsoft.AspNetCore.Mvc;
using ZR.Admin.WebApi.Filters;
using ZR.Model.Dto.Business.ProductionControl;
using ZR.Model.Models.ProductionControl;
using ZR.Service.IService.ProductionControl;

//创建时间：2024-11-04
namespace ZR.Admin.WebApi.Controllers
{
    /// <summary>
    /// 底板盖板组装
    /// </summary>
    [Verify]
    [Route("business/DcBottomplatecoverassembleclamping")]
    [ApiExplorerSettings(GroupName = "business")]
    public class DcBottomplatecoverassembleclampingController : BaseController
    {
        /// <summary>
        /// 底板盖板组装接口
        /// </summary>
        private readonly IDcBottomplatecoverassembleclampingService _DcBottomplatecoverassembleclampingService;

        public DcBottomplatecoverassembleclampingController(IDcBottomplatecoverassembleclampingService DcBottomplatecoverassembleclampingService)
        {
            _DcBottomplatecoverassembleclampingService = DcBottomplatecoverassembleclampingService;
        }

        /// <summary>
        /// 查询底板盖板组装列表
        /// </summary>
        /// <param name="parm"></param>
        /// <returns></returns>
        [HttpGet("list")]
        [ActionPermissionFilter(Permission = "dcbottomplatecoverassembleclamping:list")]
        public IActionResult QueryDcBottomplatecoverassembleclamping([FromQuery] DcBottomplatecoverassembleclampingQueryDto parm)
        {
            var response = _DcBottomplatecoverassembleclampingService.GetList(parm);
            return SUCCESS(response);
        }


        /// <summary>
        /// 查询底板盖板组装详情
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        [HttpGet("{Id}")]
        [ActionPermissionFilter(Permission = "dcbottomplatecoverassembleclamping:query")]
        public IActionResult GetDcBottomplatecoverassembleclamping(long Id)
        {
            var response = _DcBottomplatecoverassembleclampingService.GetInfo(Id);
            
            var info = response.Adapt<DcBottomplatecoverassembleclampingDto>();
            return SUCCESS(info);
        }

        /// <summary>
        /// 添加底板盖板组装
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        [ActionPermissionFilter(Permission = "dcbottomplatecoverassembleclamping:add")]
        [Log(Title = "底板盖板组装", BusinessType = BusinessType.INSERT)]
        public IActionResult AddDcBottomplatecoverassembleclamping([FromBody] DcBottomplatecoverassembleclampingDto parm)
        {
            var modal = parm.Adapt<DcBottomplatecoverassembleclamping>().ToCreate(HttpContext);

            var response = _DcBottomplatecoverassembleclampingService.AddDcBottomplatecoverassembleclamping(modal);

            return SUCCESS(response);
        }

        /// <summary>
        /// 更新底板盖板组装
        /// </summary>
        /// <returns></returns>
        [HttpPut]
        [ActionPermissionFilter(Permission = "dcbottomplatecoverassembleclamping:edit")]
        [Log(Title = "底板盖板组装", BusinessType = BusinessType.UPDATE)]
        public IActionResult UpdateDcBottomplatecoverassembleclamping([FromBody] DcBottomplatecoverassembleclampingDto parm)
        {
            var modal = parm.Adapt<DcBottomplatecoverassembleclamping>().ToUpdate(HttpContext);
            var response = _DcBottomplatecoverassembleclampingService.UpdateDcBottomplatecoverassembleclamping(modal);

            return ToResponse(response);
        }

        /// <summary>
        /// 删除底板盖板组装
        /// </summary>
        /// <returns></returns>
        [HttpDelete("delete/{ids}")]
        [ActionPermissionFilter(Permission = "dcbottomplatecoverassembleclamping:delete")]
        [Log(Title = "底板盖板组装", BusinessType = BusinessType.DELETE)]
        public IActionResult DeleteDcBottomplatecoverassembleclamping([FromRoute]string ids)
        {
            var idArr = Tools.SplitAndConvert<long>(ids);

            return ToResponse(_DcBottomplatecoverassembleclampingService.Delete(idArr));
        }

    }
}